package com.yc;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @program: concurrent
 * @description: InetAddress案例
 * @author: zy
 * @create: 2022-01-13 10:49
 */
public class Test1_InetAddress {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress ia1=InetAddress.getLocalHost();
        System.out.println(  ia1 );

       InetAddress[] ia2= InetAddress.getAllByName("www.baidu.com");
       if( ia2!=null){
           for(  InetAddress ia: ia2){
               System.out.println(   ia );
           }
       }
    }
}
